package com.tronsis.distribution.activity.me.agent;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.flyco.tablayout.SlidingTabLayout;
import com.tronsis.distribution.R;
import com.tronsis.distribution.fragment.agent.AgentExitProcessingFragment;
import com.tronsis.distribution.util.StateUtil;
import com.tronsis.library.activity.ToolBarBaseActivity;
import com.tronsis.library.adapter.SimpleViewPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class AgentExitProcessingActivity extends ToolBarBaseActivity {
    @BindView(R.id.tab_layout)
    SlidingTabLayout mTabLayout;
    @BindView(R.id.viewpager)
    ViewPager mViewPager;

    private List<Fragment> mPageList = new ArrayList<Fragment>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agent_exit_processing);
        setTitle(true, getString(R.string.exit_agent_processing));

        mPageList.add(getFragment(StateUtil.AGENT_EXIT_VERIFY));
        mPageList.add(getFragment(StateUtil.AGENT_EXIT_HANDLE));
        mPageList.add(getFragment(StateUtil.AGENT_EXIT_FINISH));
        mPageList.add(getFragment(StateUtil.AGENT_EXIT_REJECT));

        SimpleViewPagerAdapter adapter = new SimpleViewPagerAdapter(getSupportFragmentManager(), mPageList);
        mViewPager.setAdapter(adapter);

        String[] mTitles = {"待审核", "待处理", "已通过", "未通过"};
        mTabLayout.setViewPager(mViewPager, mTitles);
    }


    private AgentExitProcessingFragment getFragment(String state) {
        AgentExitProcessingFragment fm = new AgentExitProcessingFragment();
        Bundle bundle = new Bundle();
        bundle.putString("state", state);
        fm.setArguments(bundle);
        return fm;
    }
}
